6647e5b2fdea6e5f06a676292204b05a649bbee3,src/main/java/com/mycompany/myapp/SampleGradleApp.java,SampleGradleApp,addDefaultProfile,#SpringApplication#SimpleCommandLinePropertySource#,84
Before Change
* If no profile has been configured, set by default the "dev" profile.
*/
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) {
if (!source.containsProperty("spring.profiles.active") &&
!System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) {
app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT);
}
}
}
After Change
/**
* set a default to use when no profile is configured.
*/
protected static void addDefaultProfile(SpringApplication app) {
Map<String, Object> defProperties = new HashMap<>();
/*
* The default profile to use when no other profiles are defined
* This cannot be set in the `application.yml` file.
* See https://github.com/spring-projects/spring-boot/issues/1219
*/
defProperties.put("spring.profiles.default", Constants.SPRING_PROFILE_DEVELOPMENT);
app.setDefaultProperties(defProperties);
}
}